package rentadomus

class WarehouseController {

    //def index() { }
    def scaffold = Warehouse
    def save() {
        def wareInstance = new Warehouse(params)
        def placeInstance = new Place(params)
        placeInstance.idPerson = session.person
        wareInstance.idPlace = placeInstance

        if (placeInstance.save(flush: true)) {
            if (!wareInstance.save(flush: true)) {
                render(view: "create", model: [wareInstance: wareInstance])
                return
            }
        }       
        //redirect(action: "show", id: wareInstance.id)
        //redirect(action: "UploadImageController.upload", id: placeInstance.id)
        redirect(controller:"uploadImage", action: "main", id: placeInstance.id)
    }  
}